﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;



public partial class adm_sc_categories_Delete_Confirmation : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        { 
            if(Request.Params["type"]!=null && Request.Params["cid"]!=null)
            {
                int type = Convert.ToInt32(Request.Params["type"]);

                LoadCategories(drp_parent, type);
            }
            else
                Response.Redirect("Default.aspx");
        }
    }

    private void LoadCategories(DropDownList cat, int type)
    {        
        // Recursion Starts //
        CategoriesBLL.Process_Category_Items(cat, 0, type,true);
        // Process_Category_Items(cat, 0,type);
    }

    protected void btn_add_Click(object sender, EventArgs e)
    {
        int deleted_categoryid = Convert.ToInt32(Request.Params["cid"]);
        int assign_categoryid = Convert.ToInt32(drp_parent.SelectedValue);

        CategoriesBLL.Delete(deleted_categoryid, assign_categoryid);

        Response.Redirect("Default.aspx?status=deleted");
    }
}
